<%@ page contentType="text/html; charset=UTF-8" %> 
<%@page import="net.zhnb.util.*"%>
<%@ page import="net.zhnb.bean.*"%>
<%@page import="java.util.*"%>
<%@page import="finaler.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<jsp:include page="adminImport.jsp"/>
</head>
<% 
	Global global =  (Global) request.getAttribute("global");
	PageList showerList =  (PageList) request.getAttribute("showerList");
	PageList tagList =  (PageList) request.getAttribute("tagList"); 
%>

<script>
	function add(){
		$("#aform").attr("action", "<%=Constants.URL %>/admin/tagAdd");
		$("#aform").submit();
	}
	function query(){
		$("#aform").attr("action", "<%=Constants.URL %>/admin/tagManage");
		$("#aform").submit();
	}
	function del(id){
		if(confirm("确定吗!")){
			var url =  "<%=Constants.URL%>/admin/tagDel_"+id;
			window.location = url;
		}
	}
</script>

<body>

<a href="<%=Constants.URL %>/admin/menu">返回</a><br/><br/>

<form action="" id="aform" name="aform" method="post">
	展位:<select name="showerid" id="showerid">
			<%
			for( int i=0;i<showerList.getList().size();i++){
				Map<String,Object> shower = (HashMap<String,Object>) showerList.getList().get(i);
			%>
				<option value="<%=shower.get("id")%>" <%=shower.get("id").toString().equals(request.getAttribute("q_showerid"))?"selected":""%>>
					<%=shower.get("roomname") + "--" + shower.get("showername")%>
				</option>
				
			<%} %>
			</select>
	<select name="lotterylun" id="lotterylun">
			<%
			for( int i=0;i<global.getLotterylun().intValue();i++){
			%>
				<option value="<%=i+1%>" <%=(i+1+"").equals(request.getAttribute("q_lotterylun"))?"selected":""%>>
					第<%=i+1%>轮
				</option>
				
			<%} %>
			</select>
	<select name="type" id="type">
				<option value="0"  <%="0".equals(request.getAttribute("q_type"))?"selected":""%>>NFC码</option>
				<option value="1"  <%="1".equals(request.getAttribute("q_type"))?"selected":""%>>QR二维码</option>
			</select>
	<input type="button" value="增加一个标签" onclick="add()"/>
	<input type="button" value="查询" onclick="query()"/>
</form>



<!-- Table goes in the document BODY -->
<table class="hovertable">
	<tr>
	    <th>标签id</th><th>所属场馆地址</th><th>所属展位</th><th>标签分类</th><th>第几轮</th><th>删除</th><th>模拟访问</th>
	</tr>
	<%
	for( int i=0;i<tagList.getList().size();i++){
		Map<String,Object> tag = (HashMap<String,Object>) tagList.getList().get(i);
	%>
		<tr align="center" onmouseover="this.style.backgroundColor='#ffffff';" onmouseout="this.style.backgroundColor='#d4e3e5';">
		    <td><%=tag.get("id")%></td>
		    <td><%=tag.get("roomname")%></td>
		    <td><%=tag.get("showername")%></td>
		    <td><%=tag.get("type").equals(0)?"NFC":"QR"%></td>
		    <td><%=tag.get("lotterylun")%></td>
		    <td><a href="###" onclick="del('<%=tag.get("id")%>')">删除</a></td>
		    <td><a href="<%= Constants.URL%>/main/tag_<%=ProjectUtil.encodeBase64( Constants.CODE_NAME + "_"+tag.get("id")+"_" + Constants.CODE_NAME)%>" target="_blank">点击访问</a></td>
		</tr>
	<%} %>
		<tr>
		    <td colspan="7">
				<%=PageUtil.getCurrPage(tagList)%>
				<%=PageUtil.getRecord(tagList)%>
				<%=PageUtil.getSinglePaginator(tagList,false)%>
		    </td>
		</tr>
</table>



</body>
</html>